import Vue from 'vue'
import VueRouter from 'vue-router'

import Welcome from '../components/Welcome.vue'
import Home from '../components/Home.vue'
import Index from '../components/Index.vue'
import Tech from '../components/Tech/Tech.vue'
import Relax from '../components/Relax/Relax.vue'
import Life from '../components/Life/Life.vue'
import Detail from '../components/Detail/Detail.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/welcome'
  },
  {
    path: '/welcome',
    component: Welcome
  },
  {
    path: '/home',
    component: Home,
    redirect: 'home/index',
    children: [{
      path: '/home/index',
      component: Index
    }, {
      path: 'tech',
      component: Tech
    }, {
      path: 'relax',
      component: Relax
    }, {
      path: 'life',
      component: Life,
    }, {
      path: 'tech/detail/:blogId',
      name: 'detail',
      component: Detail
    }]
  }
]

const router = new VueRouter({
  mode: 'history',
  routes
})

export default router
